package com.kws.system.controller.Payment;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.kws.common.core.domain.R;
import com.kws.common.log.annotation.Log;
import com.kws.common.log.enums.BusinessType;
import com.kws.system.domain.QueryInvoiceMessageRq;
import com.kws.system.domain.TbInvoiceMessage;
import com.kws.system.service.InvoiceMessageService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <b>InvoiceMessageController</b>
 *
 * @description: InvoiceMessageController <br>
 * @date: 2024/11/19 16:18 <br>
 * @author: lhm <br>
 * @version: 1.0 <br>
 */

@Api(tags = "开票信息管理模块")
@RestController
public class InvoiceMessageController {
    private static final Logger logger = LoggerFactory.getLogger(InvoiceMessageController.class);

    @Autowired
    private InvoiceMessageService invoiceMessageService;

    @ApiOperation("分页查询开票信息列表")
    @PostMapping("/query/invoicePage")
    public R<Page<TbInvoiceMessage>> queryInvoicePage(@RequestBody QueryInvoiceMessageRq rq){
        Page<TbInvoiceMessage> pageInfo = invoiceMessageService.queryInvoicePage(rq);
        return R.ok(pageInfo);
    }

    @ApiOperation("根据ID查询开票信息详情")
    @GetMapping("/query/invoice/byId")
    public R<TbInvoiceMessage> queryInvoiceById(@RequestParam Long id){
        TbInvoiceMessage info = invoiceMessageService.queryInvoiceById(id);
        return R.ok(info);
    }

    @ApiOperation("根据ID删除开票信息")
    @Log(title = "删除开票信息", businessType = BusinessType.DELETE)
    @GetMapping("/delete/invoice/byId")
    public R deleteInvoiceById(@RequestParam Long id){
        boolean status = invoiceMessageService.deleteInvoiceById(id);
        return R.ok(status);
    }
}
